<template>
  <view class="service-container">
    <!-- 搜索服务部分 -->
    <view class="search-section">
      <text class="section-title">探索服务</text>
      <view class="service-grid">
        <view class="service-item" v-for="(item, index) in serviceList" :key="index" @click="navigateToService(item)">
          <image class="service-icon" :src="item.icon" mode="aspectFit"></image>
          <text class="service-name">{{ item.name }}</text>
        </view>
      </view>
    </view>
    
    <!-- 训练师推荐 -->
    <view class="trainer-card" @click="navigateToTrainers">
      <view class="trainer-left">
        <image class="trainer-avatar" src="/static/images/pet/trainer.png" mode="aspectFill"></image>
      </view>
      <view class="trainer-content">
        <text class="trainer-text">我们经验丰富的训练师</text>
        <text class="trainer-subtext">随时准备照顾您的宠物</text>
      </view>
      <view class="trainer-right">
        <u-icon name="arrow-right" color="#FFCC33" size="24"></u-icon>
      </view>
    </view>
    
    <!-- 特色服务 -->
    <view class="special-section">
      <text class="section-title">特色服务</text>
      <view class="special-card" @click="navigateToSpecialService">
        <view class="special-left">
          <image class="special-image" src="/static/images/pet/pet-daycare.png" mode="aspectFill"></image>
        </view>
        <view class="special-content">
          <text class="special-title">宠物日托 - ¥120</text>
          <text class="special-info">四川成都   周一</text>
        </view>
        <view class="special-right">
          <view class="call-btn">
            <u-icon name="phone" color="#FFCC33" size="24"></u-icon>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
// 页面配置
export default {
  navigationBarTitleText: '服务',
  navigationBarBackgroundColor: '#0c3441',
  navigationBarTextStyle: 'white'
}
</script>

<script setup>
import { ref } from 'vue';

// 服务列表
const serviceList = ref([
  {
    id: 1,
    name: '上门美容',
    icon: '/static/images/pet/service-grooming-home.png',
    path: '/pages/pet/service/grooming-home'
  },
  {
    id: 2,
    name: '到店美容',
    icon: '/static/images/pet/service-grooming-store.png',
    path: '/pages/pet/service/grooming-store'
  },
  {
    id: 3,
    name: '狗狗寄养',
    icon: '/static/images/pet/service-dog-boarding.png',
    path: '/pages/pet/service/dog-boarding'
  },
  {
    id: 4,
    name: '狗狗托管',
    icon: '/static/images/pet/service-dog-daycare.png',
    path: '/pages/pet/service/dog-daycare'
  },
  {
    id: 5,
    name: '狗狗训练',
    icon: '/static/images/pet/service-dog-training.png',
    path: '/pages/pet/service/dog-training'
  },
  {
    id: 6,
    name: '宠物学习',
    icon: '/static/images/pet/service-pet-learning.png',
    path: '/pages/pet/service/pet-learning'
  },
  {
    id: 7,
    name: '遛狗托管',
    icon: '/static/images/pet/service-dog-walking.png',
    path: '/pages/pet/service/dog-walking'
  },
  {
    id: 8,
    name: '宠物运输',
    icon: '/static/images/pet/service-pet-transport.png',
    path: '/pages/pet/service/pet-transport'
  }
]);

// 导航到服务详情
function navigateToService(service) {
  uni.navigateTo({
    url: service.path
  });
}

// 导航到训练师页面
function navigateToTrainers() {
  uni.navigateTo({
    url: '/pages/pet/service/trainers'
  });
}

// 导航到特色服务
function navigateToSpecialService() {
  uni.navigateTo({
    url: '/pages/pet/service/special-service'
  });
}
</script>

<style lang="scss">
page {
  background-color: #f8f8f8;
}

.service-container {
  padding: 30rpx;
  
  .section-title {
    font-size: 36rpx;
    font-weight: bold;
    margin-bottom: 30rpx;
    display: block;
  }
  
  .search-section {
    margin-bottom: 40rpx;
    
    .service-grid {
      display: flex;
      flex-wrap: wrap;
      
      .service-item {
        width: 25%;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-bottom: 30rpx;
        
        .service-icon {
          width: 100rpx;
          height: 100rpx;
          background-color: #fff5e0;
          border-radius: 20rpx;
          padding: 15rpx;
          margin-bottom: 10rpx;
        }
        
        .service-name {
          font-size: 24rpx;
          color: #333;
        }
      }
    }
  }
  
  .trainer-card {
    background-color: #0c3441;
    border-radius: 20rpx;
    padding: 30rpx;
    display: flex;
    align-items: center;
    margin-bottom: 40rpx;
    
    .trainer-left {
      margin-right: 20rpx;
      
      .trainer-avatar {
        width: 80rpx;
        height: 80rpx;
        border-radius: 50%;
        background-color: #fff;
      }
    }
    
    .trainer-content {
      flex: 1;
      
      .trainer-text {
        font-size: 28rpx;
        color: #fff;
        display: block;
      }
      
      .trainer-subtext {
        font-size: 24rpx;
        color: rgba(255, 255, 255, 0.7);
      }
    }
    
    .trainer-right {
      width: 60rpx;
      height: 60rpx;
      background-color: #fff;
      border-radius: 30rpx;
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }
  
  .special-section {
    .special-card {
      background-color: #fff;
      border-radius: 20rpx;
      padding: 30rpx;
      display: flex;
      align-items: center;
      box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.05);
      
      .special-left {
        margin-right: 20rpx;
        
        .special-image {
          width: 100rpx;
          height: 100rpx;
          border-radius: 10rpx;
        }
      }
      
      .special-content {
        flex: 1;
        
        .special-title {
          font-size: 28rpx;
          font-weight: bold;
          color: #333;
          display: block;
          margin-bottom: 10rpx;
        }
        
        .special-info {
          font-size: 24rpx;
          color: #999;
        }
      }
      
      .special-right {
        .call-btn {
          width: 60rpx;
          height: 60rpx;
          background-color: #fff8f2;
          border-radius: 30rpx;
          display: flex;
          justify-content: center;
          align-items: center;
        }
      }
    }
  }
}
</style>